/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * XMLOutputPanel.java
 *
 * Created on 23/02/2009, 15:57:22
 */
package vale.test.view;

import java.io.File;
import vale.sax.Sax;
import vale.test.myHandlers.MyContentHandler;
import vale.test.myHandlers.MyErrorHandler;

/**
 *
 * @author juan
 */
public final class XmlOutputJPanel extends javax.swing.JPanel {

    private File xmlFile;
    private MyErrorHandler eh;
    private MyContentHandler ch;
    private Sax sax;

    /** Creates new form XMLOutputPanel */
    public XmlOutputJPanel(File xmlFile) {
        initComponents();
        this.xmlFile = xmlFile;
        this.ch = new MyContentHandler(xmlFile);
        this.ch.setOutput(this.jTextArea2);
        this.eh = new MyErrorHandler();
        this.eh.setOutput(this.jTextArea1);
        this.sax = new Sax(eh, ch, xmlFile);
        Thread t=new Thread(sax);
        t.start();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextArea2 = new javax.swing.JTextArea();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTextArea3 = new javax.swing.JTextArea();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();

        setLayout(new java.awt.GridLayout(2, 0, 10, 10));

        jPanel1.setLayout(new java.awt.GridLayout(1, 2, 10, 10));

        jScrollPane2.setBorder(javax.swing.BorderFactory.createTitledBorder("XML"));

        jTextArea2.setColumns(20);
        jTextArea2.setEditable(false);
        jTextArea2.setRows(5);
        jScrollPane2.setViewportView(jTextArea2);

        jPanel1.add(jScrollPane2);

        jScrollPane3.setBorder(javax.swing.BorderFactory.createTitledBorder("DTD"));

        jTextArea3.setColumns(20);
        jTextArea3.setEditable(false);
        jTextArea3.setRows(5);
        jScrollPane3.setViewportView(jTextArea3);

        jPanel1.add(jScrollPane3);

        add(jPanel1);

        jScrollPane1.setBorder(javax.swing.BorderFactory.createTitledBorder("Mensajes"));

        jTextArea1.setColumns(20);
        jTextArea1.setEditable(false);
        jTextArea1.setRows(5);
        jScrollPane1.setViewportView(jTextArea1);

        add(jScrollPane1);
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextArea jTextArea2;
    private javax.swing.JTextArea jTextArea3;
    // End of variables declaration//GEN-END:variables
}
